<template>
	<view>
		<view class="home_top">
			<view class="search">
				<view class="search_input box">
					<view class="city box box-align-center">
						<!-- <image src="/images/Group11@3x.png"></image> -->
						<view class="txt" v-if="city">{{city}}</view>
						<view class="txt" v-else @tap="getUserLocation">无定位</view>
					</view>
					<!-- <navigator url="/pages/coupon/search?city={{city}}" class="nav search-nav box box-align-center" bindtap='handleSubmit'
					 data-name="点击搜索" data-code="search">
						<image src="/images/Group12@3x.png" class="search_img"></image>
						<view class="placeholder">搜索品牌优惠券</view>
					</navigator>=
					<button class="kfbt sharedou box box-align-center" open-type='share'>
						<image src="/images/doucopy@3x.png" mode="aspectFill"></image>
						<view class="txt">邀请领豆</view>
					</button> -->
				</view>

			</view>
		</view>
		<iframes></iframes>
	</view>
</template>

<script>
	import getlocat from "../../common/getlocat"
	import iframes from "../../components/iframe/getPhone"
	const app = getApp()
	export default {
		data() {
			return {
				city: uni.getStorageSync('usercity')
			};
		},
		components: {
			iframes
		},
		onReady() {},
		onShow() {
			this.$http.post('Index/subtitle', {}).then(res => {
				console.log(res)
			})
			console.log('我是onshow事件')
			this.getUserLocation()
			// async 
		},
		methods: {
			getUserLocation() {
				let _this = this
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('usercity')) return false
				wx.getSetting({
					success(res) {
						if (!res.authSetting["scope.userLocation"]) {
							getlocat.getAuthorizeInfo().then(()=>{
								getlocat.getLocationInfo().then(res => {
									let city = res.result.ad_info.city
									_this.city = city
								})
							})
						} else {
							getlocat.getLocationInfo().then(res => {
								let city = res.result.ad_info.city
								_this.city = city
							})
						}
					}
				})
				// #endif
			},
			getPhoneNumber(){
				console.log(1222)
			}

		}
	}
</script>

<style lang="scss">
	.container {
		padding-bottom: 10rpx;
		background: #f1f1f1;
	}

	.home_top {
		width: 100%;
		height: 420rpx;
		background: -webkit-linear-gradient(top, #FC8645, #F9573F);
		background: linear-gradient(top, #FC8645, #F9573F);
		position: relative;
	}

	.notice {
		width: 100%;
		background: #d2353c;
		height: 68rpx;
		line-height: 68rpx;
		white-space: nowrap;
		font-size: 14px;
	}

	.notice .text {
		letter-spacing: 1px;
		height: 68rpx;
		color: #fff;
		font-size: 28rpx;
	}

	/* 公告 */
	.noticelist {
		height: 68rpx;
		padding: 74rpx 20rpx 0;
		font-size: 28rpx;
		/* border-bottom: 1rpx solid #f6f4f4; */
		background: #fff;
	}

	.noticelist .noticetit image {
		width: 26rpx;
		height: 22rpx;
	}

	.noticelist .noticeswiper {
		flex: 1;
		height: 68rpx;
		margin-left: 10rpx;
	}

	.noticelist .noticeswiper .txt {
		line-height: 68rpx;
		color: #EC2921;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.search {
		padding: 14rpx 3% 20rpx;
		justify-content: center;
		align-items: center;
	}

	.search .city {
		font-size: 26rpx;
		line-height: 1.4;
		color: #fff;
	}

	.search .city image {
		width: 22rpx;
		height: 26rpx;
	}

	.search .city .txt {
		color: #FFFFFF;
		font-size: 28rpx;
		margin-left: 10rpx;
		white-space: nowrap;
	}

	.search_input {
		width: 100%;
		height: 56rpx;
		position: relative;
	}

	.search_input .nav {
		flex: 1;
		height: 56rpx;
		background: rgba(255, 255, 255, 0.3);
		border-radius: 33rpx;
		margin-left: 20rpx;
		font-size: 28rpx;
		position: relative;
	}

	.search_input .nav .placeholder {
		flex: 1;
		height: 40rpx;
		font-size: 28rpx;
		color: rgba(255, 255, 255, 0.37);
		line-height: 40rpx;
		margin-left: 8rpx;
	}

	.search_input .search_img {
		margin-left: 24rpx;
		width: 24rpx;
		height: 24rpx;
	}

	.search_input .sharedou {
		margin-left: 30rpx;
	}

	.search_input .sharedou image {
		width: 36rpx;
		height: 34rpx;
		display: block;
	}

	.search_input .sharedou .txt {
		white-space: nowrap;
		width: 104rpx;
		height: 36rpx;
		font-size: 26rpx;
		font-family: PingFang-SC-Regular;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 36rpx;
		margin-left: 10rpx;
	}

	/* .search_input .search_use {
  white-space: nowrap;
  margin-left: 16rpx;
  border: 1rpx solid #d2353c;
  padding: 5rpx 18rpx;
  border-radius: 50rpx;
  font-size: 24rpx;
  color: #d2353c;
} */

	.header {
		margin-top: 0rpx;
	}

	.header .info {
		padding: 40rpx 20rpx;
		align-items: center;
	}

	.header .info .info_img image {
		width: 96rpx;
		height: 96rpx;
		border-radius: 50%;
		margin: 0 auto;
		display: block;
		text-align: center;
	}

	.header .info .info_img .ws {
		font-size: 24rpx;
		color: #808080;
		text-align: center;
		text-decoration: underline;
	}

	.header .info .ul {
		flex: 1;
		margin-left: 20rpx;
	}

	.header .info .ul .li {
		width: 33.3%;
		text-align: center;
		position: relative;
	}

	.header .info .ul .li .bubble {
		position: absolute;
		top: 100%;
		left: 70%;
		width: 120rpx;
		height: 40rpx;
		background: url(http://wq.senwellzy.cn/Public/Images/vquan/home_bubble.png) no-repeat;
		background-size: 120rpx 40rpx;
	}

	.header .info .ul .li .bubble .bbt {
		font-size: 20rpx;
		padding: 10rpx 30rpx;
		white-space: nowrap;
		color: #d2353c;
		font-weight: bolder;
	}

	.header .info .ul .li .txt {
		line-height: 36rpx;
		color: #FFFFFF;
		font-size: 26rpx;
		margin-top: 8rpx;
	}

	.header .info .ul .li .num {
		font-size: 38rpx;
		font-weight: bolder;
		color: rgba(255, 255, 255, 1);
		line-height: 52rpx;

	}

	.banner {
		position: absolute;
		width: 100%;
		height: 200rpx;
		bottom: -58rpx;
	}

	.banner image {
		width: 100%;
		height: 200rpx;
		text-align: center;
		overflow: hidden;
		border-radius: 24rpx;
		transform: scale(0.94);
		/* box-shadow: 0 12rpx 20rpx #EC2921; */
	}

	/* 券专区 */

	.Preferential {
		/* margin-top: 20rpx; */
		/* background: #fff; */
	}

	.Preferential .arealist {
		width: 100%;
		background: #FFFFFF;
		/* border-bottom: 1rpx solid #d9ded8; */
		height: 98rpx;
	}

	.Preferential .arealist .item {
		width: 50%;
		text-align: center;
		height: 80rpx;
		line-height: 80rpx;
	}

	.Preferential .arealist .item .img_nav {
		width: 36rpx;
		height: 36rpx;
	}

	.Preferential .arealist .item .img_nav image {
		width: 100%;
		height: 100%;
		display: block;
	}

	.Preferential .arealist .item .name {
		margin-left: 8rpx;
		font-size: 36rpx;
		font-weight: bolder;
		color: rgba(90, 90, 90, 1);
	}

	.Preferential .arealist .item.active {
		position: relative;
	}

	.Preferential .arealist .item.active:after {
		content: ' ';
		position: absolute;
		top: 92%;
		left: 50%;
		margin-left: -70rpx;
		height: 8%;
		width: 140rpx;
		background: -webkit-linear-gradient(top, #FC893C, #FF7E1A);
		background: linear-gradient(top, #FC893C, #FF7E1A);
		border-radius: 8rpx;
		overflow: hidden;
	}

	.brandlist {
		/* border-bottom: 1rpx solid #d9ded8; */
		/* height: 150rpx; */
	}

	.brandlist .scroll_ul {
		white-space: nowrap;
		margin-left: -20rpx;
		padding: 30rpx 0;
	}

	.brandlist .scroll_li {
		display: inline-block;
		position: relative;
		width: 160rpx;
	}

	.brandlist .scroll_li:nth-child(1) {
		margin-left: 20rpx;
	}

	.brandlist .scroll_li .mycon {
		flex-flow: column nowrap;

	}

	.brandlist .scroll_li .logo {
		width: 96rpx;
		height: 96rpx;
	}

	.brandlist .scroll_li .logo image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
		overflow: hidden;
	}

	.brandlist .scroll_li .name {
		color: #999999;
		font-size: 22rpx;
		margin-top: 10rpx;
	}

	.brandlist .scroll_li.on .name {
		position: relative;
		color: #d2353c;
		background: rgba(0, 0, 0, 0);
	}

	.brandlist .more {
		white-space: nowrap;
		text-align: center;
		font-size: 36rpx;
		color: #808080;
	}

	.brandlist .more.on {
		color: #d2353c;
	}

	.recommend {
		font-size: 28rpx;
		background: #fff;
	}

	.recommend .tit {
		line-height: 2;
	}

	.recommend .exchange {
		text-decoration: underline;
	}

	.funlist {
		padding: 20rpx 0rpx;
	}

	.funlist .item {
		width: 50%;
		flex-flow: column nowrap;
	}

	.funlist .item .img_nav {
		width: 90rpx;
		height: 90rpx;
	}

	.funlist .item .img_nav image {
		width: 100%;
		height: 100%;
	}

	.funlist .item .txt {
		text-align: center;
		margin-top: 10rpx;
	}

	.customer {
		position: fixed;
		bottom: 200rpx;
		right: 20rpx;
		z-index: 8888;
	}

	.customer .sale {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		overflow: hidden;
	}

	.customer .sale image {
		width: 100rpx;
		height: 100rpx;
	}



	.gift {
		position: fixed;
		right: 20rpx;
		bottom: 330rpx;
		z-index: 888;
	}

	.gift .img_nav {
		width: 104rpx;
		height: 118rpx;
		animation: skake 3s ease-in 0s infinite;
		-webkit-animation: shake 3s ease-in 0s infinite;
	}

	.gift .img_nav image {
		width: 100%;
		height: 100%;
	}

	@keyframes shake {
		0% {
			transform: scale(0.95);
		}

		50% {
			transform: scale(1.2);
		}

		100% {
			transform: scale(0.95);
		}
	}


	/* 温馨提示*/
	.timechoose {
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: 88888;
	}

	.timechoose .content {
		position: absolute;
		top: 286rpx;
		left: 10%;
		width: 80%;
		z-index: 88;
		background: #fff;
		border-radius: 36rpx;
		overflow: hidden;
	}

	.timechoose .content .title {
		color: #2f2f2f;
		font-size: 32rpx;
		text-align: center;
		padding: 48rpx 26rpx;
		line-height: 44rpx;
		font-weight: bolder;
	}

	.timechoose .content .con {
		font-size: 28rpx;
		color: #818181;
		line-height: 50rpx;
		padding: 0 44rpx;
		text-indent: 2em;
	}

	.timechoose .content .btns {
		margin-top: 58rpx;
		height: 88rpx;
		width: 100%;
	}

	.timechoose .content .btns .btn_child {
		width: 50%;
		text-align: center;
		line-height: 88rpx;
		color: #fff;
	}

	.timechoose .content .btns .back_btn {
		background: #d8d8d8;
	}

	.timechoose .content .btns .sub_btn {
		background: #0ec124;
	}

	.timechoose .make {
		position: absolute;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.7);
	}
</style>
